from celery.task import task
from .models import *

#自定义异步任务
@task
def async_test():

	print("异步任务")

	return '123123'

@task
def update_username(username,new_username):
	user = UserModel.objects.filter(username=new_username)
	if user:
		return '用户名已经存在celery'
	else:
		UserModel.objects.filter(username=username).update(username=new_username)
		return '修改成功celery'